package com.finalterm.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.finalterm.order.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单Mapper
 */
@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    
    /**
     * 查询超时未支付的订单
     */
    @Select("SELECT * FROM orders WHERE status = 'PENDING' AND create_time < #{timeoutTime}")
    List<Order> selectTimeoutOrders(@Param("timeoutTime") LocalDateTime timeoutTime);
}
